<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>

<body>
  <div id="app">
    <!-- 收集select单选,要把v-model写在select上,使用字符串收集 -->
    <h1>请选择你的答案</h1>
    <select v-model="ans">
      <option value="A">A</option>
      <option value="B">B</option>
      <option value="C">C</option>
      <option value="D">D</option>
    </select>

    <!-- 收集select多选,要把v-model写在select上,使用数组收集(收集多个同类型数据) -->
    <h1>请选择你喜欢的学科</h1>
    <select v-model="project" multiple>
      <option value="前端">前端</option>
      <option value="java">java</option>
      <option value="C">测试</option>
      <option value="D">产品</option>
      <option value="D">UI</option>
      <option value="D">运维</option>
    </select>

    <hr>
    <span>本人最喜欢的字母是{{ans}}</span>
    <span>最喜欢的科目是 {{project}} </span>





  </div>
  <script>
    Vue.config.productionTip = false;

    const vm = new Vue({
      el: "#app",
      data () {
        return {
          ans: "A",
          project: [],
        };
      },
    });
  </script>
</body>

</html>